# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=minizip
pkgver=1.3
pkgrel=1
pkgdesc="a library for manipulation with files from .zip archives"
arch="all"
license="Zlib"
url="https://zlib.net/"
depends_dev="zlib-dev"
makedepends="$depends_dev automake autoconf libtool"
subpackages="$pkgname-static $pkgname-dev"
options="!check" # No testsuite
source="https://zlib.net/zlib-$pkgver.tar.xz
	zlib-1.2.8-minizip-include.patch
	CVE-2023-45853.patch
	"

builddir="$srcdir/zlib-$pkgver"/contrib/minizip

# secfixes:
#   1.3-r1:
#     - CVE-2023-45853
#   1.2.12-r0:
#     - CVE-2018-25032

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure \
		--prefix=/usr \
		--enable-static=yes
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
3868ac4da5842dd36c9dad794930675b9082ce15cbd099ddb79c0f6bd20a24aa8f33a123f378f26fe0ae02d91f31f2994dccaac565cedeaffed7b315e6ded2a2  zlib-1.3.tar.xz
d325818f4674c7aff9e97a6446b01197d89149803b1994441fdcdbdd216206184085cb841bac73dd87472c386335b07283a28cbf852766acd99d55c63f32112d  zlib-1.2.8-minizip-include.patch
2304011af6364a15e274f1ca58ee5089ce25775f6ba48c4420936b0c49cdba429589b0337182a47b4c458f711b9254507a6ad824288e1913f3c9368b26add374  CVE-2023-45853.patch
"
